<?php
$link=mysql_connect('localhost','root','root') or die('fault in connection');
$db="cardescription";
mysql_select_db( $db, $link )or die ( "Couldn't open $db: ".mysql_error() );

if($_GET[f_id]){
    header( "Location: edit_table.php?t_id=$_GET[t_id]" ) ;
    $query01="DELETE FROM fields where ID=".$_GET[f_id]."";
    mysql_query($query01)or die("can not :". mysql_errno());

}
else{
header( 'Location: index.php' ) ;
$table_id=$_GET['t_id'];
$link=mysql_connect('localhost','root','root') or die('fault in connection');
$db="cardescription";
mysql_select_db( $db, $link )or die ( "Couldn't open $db: ".mysql_error() );

$query01="DELETE FROM fields where tableID=".$table_id."";
echo $query01;
mysql_query($query01)or die("can not :". mysql_errno());
$query02="DELETE FROM tables where ID=".$table_id."";
echo $query02;
mysql_query($query02) or die("can not :". mysql_errno());
}
?>
